package com.des1gn.ymgetil.util;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;

/**
 * @ClassName TimeUtil
 * @Description TODO
 * @Author Des1gn
 * @Date 2021/12/9 10:52
 * @Version 1.0
 **/
public class TimeUtil {

    public static Long getNowMillis(){
        String s = HttpUtil.get("http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp");
        JSONObject jsonObject = JSONObject.parseObject(s);
        return jsonObject.getJSONObject("data").getLong("t");
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        System.out.println(getNowMillis());
        System.out.println("用时:"+(System.currentTimeMillis()-start));
    }

}
